package com.thoughtworks.biblioteca.command;

import com.thoughtworks.biblioteca.controller.UserController;
import com.thoughtworks.biblioteca.util.ConsoleUtil;


public class CheckLibraryNumber implements ICommand {

    private ConsoleUtil consoleUtil;


    public void doExecute() {
        checkLibraryNumber();
    }

    private void checkLibraryNumber() {
        System.out.println("Please input your library number:\n");

        String libraryNumber= consoleUtil.getStringFromConsole();

        boolean isAvailableLibraryNumber=new UserController().checkUserName(libraryNumber);

        if(isAvailableLibraryNumber){
            System.out.println("Your library number is available: "+libraryNumber);
        }else{
            System.out.println("\n");
            System.out.println("Please talk to Librarian. Thank you.");
        }
    }


}
